/**
 * 
 */
package edu.sjtu.se.prophet.io.gson;

import java.lang.reflect.Type;
import java.util.List;

import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;

import edu.sjtu.se.prophet.graph.Graph;

/**
 * @author willard
 * 
 */
public class GraphListSerializer implements JsonSerializer<List<Graph>> {

    @Override
    public JsonElement serialize(List<Graph> graphs, Type type,
            JsonSerializationContext context) {
        JsonArray array = new JsonArray();
        for (Graph graph : graphs) {
            array.add(context.serialize(graph));
        }
        return array;
    }

}
